import request from "@/utils/request";

const IMAGE_BASE_URL = "/admin";

const ImageAPI = {
  // 删除图片
  delImagesData(filename: string) {
    return request<any, any>({
      url: `${IMAGE_BASE_URL}/delImages`,
      method: "delete",
      data: { filename },
    });
  },

  // 获取所有图片文件
  getImagesData() {
    return request<any, ImageData>({
      url: `${IMAGE_BASE_URL}/getImages`,
      method: "get",
    });
  },
};

export default ImageAPI;

// 获取图片数据的类型
export interface ImageData {
  count: number;
  images: Images[];
}

export interface Images {
  name: string;
  url: string;
}
